const { contextBridge , ipcRenderer} = require('electron')

window.addEventListener('DOMContentLoaded', ()=>{
  const info = document.getElementById('info')
  const title = document.getElementById('title')
  console.log('domcontentloaded')
  ipcRenderer.on('filename', (event, content, filename) => {
    info.innerHTML = content
    title.innerText = filename
  })

})


contextBridge.exposeInMainWorld('versions', {
  node: () => process.versions.node,
  chrome: () => process.versions.chrome,
  electron: () => process.versions.electron,
  message: (text) => ipcRenderer.invoke('rendermd', text).then((result)=>{
    return result;
  }),
})



